cmake_minimum_required(VERSION 3.15.1)
project(base_pack)

include_directories(./include/)

set(BASE_DIR bp)
add_subdirectory(${BASE_DIR})

##############################################
#test project
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")

set(DEPS_ROOT_DIR "${CMAKE_SOURCE_DIR}/.deps")
set(GTEST_DIR "${DEPS_ROOT_DIR}/gtest/googletest")
if (EXISTS "${GTEST_DIR}")
    add_subdirectory("${GTEST_DIR}")
    include_directories("${GTEST_DIR}/include")
endif()

set(BASE_PACK_TEST_DIR test)
set(BASE_PACK_TEST_SRCS
    ${BASE_PACK_TEST_DIR}/main.cc)

set(BASE_PACK_STRING_TEST_SRCS 
    ${BASE_PACK_TEST_DIR}/string_test_base.h
    ${BASE_PACK_TEST_DIR}/string_test.cc
    ${BASE_PACK_TEST_DIR}/unicode_test.cc)
source_group(test\\\\string FILES ${BASE_PACK_STRING_TEST_SRCS})
list(APPEND BASE_PACK_TEST_SRCS ${BASE_PACK_STRING_TEST_SRCS})

set(BASE_TEST_TARGET base_pack_test)
add_executable(${BASE_TEST_TARGET} ${BASE_PACK_TEST_SRCS})

#set_property(TARGET ${BASE_TEST_TARGET} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_link_libraries(${BASE_TEST_TARGET} libbasepack gtest)
